﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_ThemMoiDoanhNghiep : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btn_Add_Click(object sender, EventArgs e)
    {
        tbDoanhNghiepEntities kh = new tbDoanhNghiepEntities();
        kh.TenDN = txt_TenDN.Text;
        kh.Email = txt_Email.Text;
        kh.TaiKhoan = txt_TaiKhoan.Text;
        kh.MatKhau = txt_MatKhau.Text;
        kh.DiaChi = txt_DiaChi.Text;
        kh.DienThoai = txt_DienThoai.Text;

        string user = txt_TaiKhoan.Text;
        string pass = txt_MatKhau.Text;

        if (tbDoanhNghiepBUS.KTDoanhNghiep2(user))
        {
            l1.Text = "Tên đăng nhập đã đuợc sử dụng";

        }
        else
        {
            tbDoanhNghiepBUS.Insert(kh);
            Response.Redirect("~/Admin/DanhSachDoanhNghiep.aspx");
        }
    }
}
